<template>
  <div class="register">
    <el-card shadow="hover" header="注册界面">
      <el-form  size="small" label-width="60px" @submit.native.prevent="login">
        <el-form-item label="用户名">
          <el-input placeholder="请输入用户名..." v-model="model.username">用户名</el-input>
        </el-form-item>
        <el-form-item label="密码" >
          <el-input type="password" placeholder="请输入密码..." v-model="model.password">密码</el-input>
        </el-form-item>
        <el-form-item label="昵称" >
          <el-input v-model="model.nickname">密码</el-input>
        </el-form-item>
        <el-form-item label="性别">
          <el-radio-group v-model="model.sex" class="group">
            <el-radio label="男"></el-radio>
            <el-radio label="女"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="验证码">
            <div style="display: flex">
              <el-input v-model="model.captcha"/>
              <span v-html="captcha"></span>
            </div>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" style="margin-right: 50px;" native-type="submit">注册</el-button>
        </el-form-item>
      </el-form>
    </el-card>

  </div>
</template>

<script>
  export default {
    name: "Register",
    data(){
      return{
        labelPosition:'right',
        model:{},
        captcha:''
      }
    },
    methods:{
      async getCaptcha(){
        const res = await this.$http.get('/captcha')
        this.captcha = res.data
      }
    },
    created() {
      this.getCaptcha()
    }
  }
</script>

<style lang="scss" scoped>
  .register::before{
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    background-color: #c47c89;
    /*filter: blur(3px);*/
    z-index: -1;
    opacity: 0.4;
    /*background: url("../../assets/img/bg.jpg") no-repeat;*/
  }
  .el-card{
    width: 25rem;
    margin: 10rem auto;
    text-align: center;

  }
  /deep/ .el-form-item__content{
    margin-left: 0 !important;
  }
  .group{
   margin-left: -60%;
  }
</style>
